﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Zeus.Biz.Northwind.Model;
using Zeus.Biz.DAL.EF.Northwind;

namespace Zeus.Wpf.DataViewer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DisplayAllEmployees();
        }

        private void DisplayAllEmployees()
        {
            StatusText.Content = "Displaying all employees";
            NorthwindContext context = new NorthwindContext("NorthwindConnection");
            List<Employee> employees = context.Employees.Include("Orders").ToList();
            DisplayList(employees);
        }

        private void DisplayEmployees(IEnumerable<Employee> employees)
        {
            DisplayList(from employee in employees
                        orderby employee.FirstName
                        select employee);
        }

        private void DisplayList(IEnumerable dataToList)
        {
            Listing.DataContext = dataToList;
        }
    }
}


